home *** CD-ROM | disk | FTP | other *** search
/ PC & Mediji 1998 February / PCM_9802.iso / programi / director / data.z / Behavior Library.cst / 00016_Script_Message Movie in a Window < prev    next >
Text File  |  1997-05-09  |  3KB  |  81 lines

  1. -- Movie in a Window Message 
  2.  
  3.  
  4.  
  5. -- will 'tell' a movie to 'do' something, optionally a text field can be looked at for additional commands.
  6. -- 
  7. -- also functions through lingo by handling message 'initMIAWMessage', 
  8. -- for example if this behavior was assigned to sprite 5, use
  9. -- sendsprite 5, #initMIAWMessage
  10.  
  11. property  windowName, commandName, parameters, whichEvent
  12.  
  13. on initMIAWMessage me
  14.   init me
  15. end
  16.  
  17. on mouseUp me
  18.   if whichEvent = #mouseup    then init me
  19. end
  20.  
  21. on mouseDown me
  22.   if whichEvent = #mousedown  then init me
  23. end
  24.  
  25. on prepareFrame me
  26.   if whichEvent = #prepareframe then init me
  27. end
  28.  
  29. on enterFrame me
  30.   if whichEvent = #enterframe then init me
  31. end
  32.  
  33. on exitFrame me
  34.   if whichEvent = #exitframe  then init me
  35. end
  36.  
  37. on init me
  38.   if ( word 1 of parameters = "field" ) then
  39.     set parameters = the text of field ( word 2 of parameters )
  40.   else if ( word 1 of parameters = "sprite" ) then
  41.     set parameters = field the castNum of sprite ( word 2 of parameters )    
  42.   end if
  43.   set argv = "(" & QUOTE & parameters & QUOTE & ")"
  44.   tell window ( the windowName of me ) to do ( the commandName of me ) && argv
  45. end
  46.  
  47. ---
  48.  
  49. on getPropertyDescriptionList
  50.   
  51.   set p_list = [ ¼
  52.      #commandName: [ #comment:   "Command:", ¼
  53.                       #format:   #string, ¼
  54.                      #default:    "                                     " ], ¼
  55.       #parameters: [ #comment:   "Parameters:", ¼
  56.                       #format:   #string, ¼
  57.                      #default:    "                                     " ], ¼
  58.       #windowName: [ #comment:   "Target Window:", ¼
  59.                       #format:   #string, ¼
  60.                      #default:    "" ], ¼
  61.       #WhichEvent: [ #comment:   "Initializing Event:", ¼
  62.                       #format:   #symbol, ¼
  63.                        #range: [ #MouseUp, #MouseDown, #PrepareFrame, #EnterFrame, #ExitFrame, #InitMIAWMessage], ¼
  64.                      #default:   #MouseUp ] ¼
  65.                  ]
  66.   return p_list  
  67. end
  68.  
  69. on getBehaviorDescription
  70.   return ¼
  71. "Sends a command or message to a movie in a window.  Enter arguments in the Parameters text entry box." & RETURN & ¼
  72. "PARAMETERS:" & RETURN & ¼
  73. "ò Command - Enter the name of command to send window." & RETURN & ¼
  74. "ò Parameters - Enter the arguments required by the command." & RETURN & ¼
  75. "ò Target Window - Enter the name of the window to which the message should be delivered." & RETURN & ¼
  76. "ò Initializing Event - Specify the event that triggers the behavior."& RETURN & ¼
  77. "NOTES:" & RETURN & ¼
  78. "If the first two words in the Parameters box are 'field' (without quotes) followed by the name of the field cast member (enclosed in double quotes) then the text in the field cast member will be used as the argument for the command begin sent."
  79. end
  80.  
  81.